Skip to content

Add contribution guidelines for experimental features#867

Merged
kaix-nv merged 1 commit intomainfrom
kaix/experimental
Feb 7, 2026
Merged

Add contribution guidelines for experimental features#867
kaix-nv merged 1 commit intomainfrom
kaix/experimental

Conversation

@kaix-nv
Copy link
Copy Markdown
Contributor

@kaix-nv kaix-nv commented Feb 6, 2026

What does this PR do?

Type of change: ?

Overview: ?

Usage

# Add a code snippet demonstrating how to use this

Testing

Before your PR is "Ready for review"

  • Make sure you read and follow Contributor guidelines and your commits are signed.
  • Is this change backward compatible?: Yes/No
  • Did you write any new necessary tests?: Yes/No
  • Did you add or update any necessary documentation?: Yes/No
  • Did you update Changelog?: Yes/No

Additional Information

Summary by CodeRabbit

  • Documentation

    • Added comprehensive guide for experimental optimization technique development, including recommended structure, testing conventions, licensing requirements, and graduation path to production.
  • New Features

    • Introduced experimental package with templates and utilities for implementing research-stage optimization techniques. Includes configuration framework and example code patterns. Emits stability warnings to indicate unstable APIs.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This PR establishes a new experimental package with documentation and a template structure for organizing experimental optimization technique prototypes. It includes a package-level README with guidelines and requirements, an experimental module initializer that emits a stability warning, and a template directory containing example configuration, implementation, test, and usage files for new experimental techniques.

Changes

Cohort / File(s) Summary
Experimental Package Setup
experimental/README.md, experimental/__init__.py
Introduces experimental package documentation outlining structure, requirements, quick-start workflow, and graduation path to production. Package initializer declares empty public API and emits FutureWarning on import.
Template Scaffold
experimental/_template/README.md, experimental/_template/__init__.py, experimental/_template/config.py, experimental/_template/example_usage.py, experimental/_template/implementation.py, experimental/_template/test_template.py
Provides template files for new experimental techniques, including Pydantic configuration model with validation, minimal PyTorch example model, basic unit test, and documentation template with customization checklist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding contribution guidelines (README, template, and init files) for the experimental features directory.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kaix/experimental

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@experimental/_template/test_template.py`:
- Line 1: Update the SPDX copyright header in the new test file
(test_template.py) to reflect the correct year (change "2024" to "2026"); locate
the header line with "SPDX-FileCopyrightText" and replace the year portion so
the file's copyright year matches the creation year.
🧹 Nitpick comments (3)
experimental/_template/README.md (1)

14-18: Consider suggesting renaming test_template.py after copying.

Step 3 says to write tests in test_template.py, but after copying the template to experimental/my_technique/, the test file should ideally be renamed to match the new technique (e.g., test_my_technique.py). A brief note would reduce confusion.

experimental/_template/config.py (2)

46-51: TEMPLATE_DEFAULT_CONFIG redundantly restates field defaults.

Since TemplateConfig() with no arguments already produces identical values (all fields have defaults), this constant just duplicates information. It's fine as an illustrative template example, but a comment noting this would help contributors understand the intent is to show the pattern, not that explicit values are required.


40-43: Update class Config to use Pydantic v2 model_config pattern for consistency with the codebase.

The template currently uses the deprecated Pydantic v1-style inner class Config. The codebase already uses the modern Pydantic v2 pattern throughout (see modelopt/torch/opt/config.py, modelopt/torch/distill/config.py, etc.). Update to:

from pydantic import BaseModel, ConfigDict, Field

class TemplateConfig(BaseModel):
    # ... fields ...
    
    model_config = ConfigDict(validate_assignment=True)

Comment thread experimental/_template/test_template.py Outdated
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Copyright year appears outdated for a newly created file.

This file is being added in 2026 but the copyright header says 2024.

-# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
🤖 Prompt for AI Agents
In `@experimental/_template/test_template.py` at line 1, Update the SPDX copyright
header in the new test file (test_template.py) to reflect the correct year
(change "2024" to "2026"); locate the header line with "SPDX-FileCopyrightText"
and replace the year portion so the file's copyright year matches the creation
year.

Comment thread experimental/README.md Outdated
```text
experimental/my_technique/
├── README.md # What it does, how to use it
├── implementation.py # Core code
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should indicate explicitly that a package of code is also allowed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one line: Organize your code as simple files or as a package

Comment thread experimental/_template/implementation.py Outdated
@shengliangxu
Copy link
Copy Markdown
Collaborator

Overall it looks good as a start.

Comment thread experimental/_template/README.md Outdated
Comment thread experimental/_template/README.md Outdated
optimized = my_optimize(model)
```

## Status
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also ask for a model support list as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread experimental/README.md Outdated
Comment thread experimental/README.md Outdated

## Requirements

**Must have:**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also list an up limit to lines of code for PR contributions. E.g. we cannot accept a feature that has e.g. 100k lines of change etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread experimental/README.md Outdated

- Working code with clear variable names
- README explaining what it does and how to use it
- At least one test showing it works
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed for experimental

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually do not agree. To have an experimental feature to be put into the repo, a piece of illustration code that actually runs is necessary. However, calling it an "example" is better than a "test" in this context.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is required: README should briefly describe the optimization technique and the basic usage.

Comment thread experimental/README.md Outdated
**Optional:**

- Comprehensive tests
- Full documentation
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this can be required

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread experimental/README.md Outdated

- Comprehensive tests
- Full documentation
- Pass all pre-commit checks
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also make it a requirement?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pre-commit should automatically run checks on experimental code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread experimental/README.md

- Novel or research-stage algorithms
- Not yet production-ready
- May have unstable APIs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also not guarantee experimental features working across releases. user should be with their own to use the experimental features.

Can we also mention that user can request in github issues to promote certain features to be fully integrated so we can use that as a production readiness check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread experimental/README.md Outdated

```text
experimental/my_technique/
├── README.md # What it does, how to use it
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we want to achieve here by enforcing a template?

IMHO, maybe a clear README.md is all we need?

Copy link
Copy Markdown
Contributor Author

@kaix-nv kaix-nv Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My plan is to provide a structural guideline for developers. The template might be over-engineering this. If contributors are sophisticated enough to write experimental codes, they can organize their code. I'll remove the template.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.43%. Comparing base (62c2799) to head (5b61480).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #867   +/-   ##
=======================================
  Coverage   73.43%   73.43%           
=======================================
  Files         197      197           
  Lines       20651    20651           
=======================================
  Hits        15166    15166           
  Misses       5485     5485           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread experimental/_template/README.md Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing requirements.txt marking all additional dependencies than what is already there in modelopt deps

Copy link
Copy Markdown
Collaborator

@shengliangxu shengliangxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a starting point.

Comment thread experimental/README.md Outdated

## Path to Production

When ready for production (proven effective, stable API, full tests, good docs), open an issue to propose graduating to the main `modelopt` package.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this experimental meant for our team or external contributors? Why not have experimental code in a separate feature branch and then merge to main when mature?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for external contributors.

Comment thread experimental/README.md
- Full documentation
- Pass all pre-commit checks

## Path to Production
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would ask the authors to provide info on deployment, e.g., any FWs supported with kernel needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, added.

Comment thread experimental/_template/README.md Outdated

## References

- Links to papers or related work
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code repo, project page if exist

@kaix-nv kaix-nv force-pushed the kaix/experimental branch 3 times, most recently from d6bcb38 to 8d6ee43 Compare February 6, 2026 23:55
@kaix-nv kaix-nv enabled auto-merge (squash) February 6, 2026 23:57
Signed-off-by: Kai Xu <kaix@nvidia.com>
@kaix-nv kaix-nv merged commit e53ca61 into main Feb 7, 2026
34 checks passed
@kaix-nv kaix-nv deleted the kaix/experimental branch February 7, 2026 00:31
danielkorzekwa pushed a commit that referenced this pull request Feb 17, 2026
## What does this PR do?

**Type of change:** ? <!-- Use one of the following: Bug fix, new
feature, new example, new tests, documentation. -->

**Overview:** ?

## Usage
<!-- You can potentially add a usage example below. -->

```python
# Add a code snippet demonstrating how to use this
```

## Testing
<!-- Mention how have you tested your change if applicable. -->

## Before your PR is "*Ready for review*"
<!-- If you haven't finished some of the above items you can still open
`Draft` PR. -->

- **Make sure you read and follow [Contributor
guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)**
and your commits are signed.
- **Is this change backward compatible?**: Yes/No <!--- If No, explain
why. -->
- **Did you write any new necessary tests?**: Yes/No
- **Did you add or update any necessary documentation?**: Yes/No
- **Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**:
Yes/No <!--- Only for new features, API changes, critical bug fixes or
bw breaking changes. -->

## Additional Information
<!-- E.g. related issue. -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added comprehensive guide for experimental optimization technique
development, including recommended structure, testing conventions,
licensing requirements, and graduation path to production.

* **New Features**
* Introduced experimental package with templates and utilities for
implementing research-stage optimization techniques. Includes
configuration framework and example code patterns. Emits stability
warnings to indicate unstable APIs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Kai Xu <kaix@nvidia.com>
sugunav14 pushed a commit that referenced this pull request Feb 17, 2026
## What does this PR do?

**Type of change:** ? <!-- Use one of the following: Bug fix, new
feature, new example, new tests, documentation. -->

**Overview:** ?

## Usage
<!-- You can potentially add a usage example below. -->

```python
# Add a code snippet demonstrating how to use this
```

## Testing
<!-- Mention how have you tested your change if applicable. -->

## Before your PR is "*Ready for review*"
<!-- If you haven't finished some of the above items you can still open
`Draft` PR. -->

- **Make sure you read and follow [Contributor
guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)**
and your commits are signed.
- **Is this change backward compatible?**: Yes/No <!--- If No, explain
why. -->
- **Did you write any new necessary tests?**: Yes/No
- **Did you add or update any necessary documentation?**: Yes/No
- **Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**:
Yes/No <!--- Only for new features, API changes, critical bug fixes or
bw breaking changes. -->

## Additional Information
<!-- E.g. related issue. -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added comprehensive guide for experimental optimization technique
development, including recommended structure, testing conventions,
licensing requirements, and graduation path to production.

* **New Features**
* Introduced experimental package with templates and utilities for
implementing research-stage optimization techniques. Includes
configuration framework and example code patterns. Emits stability
warnings to indicate unstable APIs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Kai Xu <kaix@nvidia.com>
danielkorzekwa pushed a commit that referenced this pull request Mar 4, 2026
## What does this PR do?

**Type of change:** ? <!-- Use one of the following: Bug fix, new
feature, new example, new tests, documentation. -->

**Overview:** ?

## Usage
<!-- You can potentially add a usage example below. -->

```python
# Add a code snippet demonstrating how to use this
```

## Testing
<!-- Mention how have you tested your change if applicable. -->

## Before your PR is "*Ready for review*"
<!-- If you haven't finished some of the above items you can still open
`Draft` PR. -->

- **Make sure you read and follow [Contributor
guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)**
and your commits are signed.
- **Is this change backward compatible?**: Yes/No <!--- If No, explain
why. -->
- **Did you write any new necessary tests?**: Yes/No
- **Did you add or update any necessary documentation?**: Yes/No
- **Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**:
Yes/No <!--- Only for new features, API changes, critical bug fixes or
bw breaking changes. -->

## Additional Information
<!-- E.g. related issue. -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added comprehensive guide for experimental optimization technique
development, including recommended structure, testing conventions,
licensing requirements, and graduation path to production.

* **New Features**
* Introduced experimental package with templates and utilities for
implementing research-stage optimization techniques. Includes
configuration framework and example code patterns. Emits stability
warnings to indicate unstable APIs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants